﻿using System;
using System.Linq;
using NUnit.Framework;
using Uber.Core.Model;
using Uber.WebUI;

namespace Uber.Test
{
    public class ExtensionsTest
    {
        [Test]
        public void GetRecipients()
        {
            var s = "@jora @jon @dre";
            var c = s.GetRecipients();
            Assert.AreEqual(c.Count(), 3);
            foreach (var o in c)
            {
                Console.WriteLine(o);
            }
        }
    }

    public class UitTests
    {
        [Test]
        public void GetDateAgo()
        {
            Console.WriteLine(Ui.DateAgo(DateTime.Now.AddMinutes(-3)));
            Console.WriteLine(Ui.DateAgo(DateTime.Now.AddDays(-19)));
            Console.WriteLine(Ui.DateAgo(DateTime.Now.AddMonths(-7)));
        }
    }

    public static class TestingTools
    {
        public static void IsEqualTo(this object o, object oo)
        {
            Assert.AreEqual(oo, o);
        }

        public static void IsTrue(this bool o)
        {
            Assert.IsTrue(o);
        }

        public static GoldBuy AsGoldBuy(this string tid)
        {
            return new GoldBuy
            {
                Amount = 30,
                Nid = 23,
                Tid = tid,
                Quantity = 123,
                Timp = DateTime.Now
            };
        }
    }
}